<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 3.9.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.4.2">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.4.2">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.4.2">
  <link rel="mask-icon" href="/images/logo.svg?v=7.4.2" color="#222">

<link rel="stylesheet" href="/css/main.css?v=7.4.2">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '7.4.2',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: '',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    },
    sidebarPadding: 40
  };
</script>

  <meta name="description" content="Hexo是一个基于node.js的快速、简洁且高效的博客框架。Hexo使用Markdown或其他渲染引擎解析文章，在几秒内，即可利用主题生成静态网页。">
<meta name="keywords" content="hexo">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo多平台部署page">
<meta property="og:url" content="http://chengg.top/2017/02/25/Hexo多平台部署page/index.html">
<meta property="og:site_name" content="CHENG&#39;s NOTES">
<meta property="og:description" content="Hexo是一个基于node.js的快速、简洁且高效的博客框架。Hexo使用Markdown或其他渲染引擎解析文章，在几秒内，即可利用主题生成静态网页。">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-10-23T14:34:12.034Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Hexo多平台部署page">
<meta name="twitter:description" content="Hexo是一个基于node.js的快速、简洁且高效的博客框架。Hexo使用Markdown或其他渲染引擎解析文章，在几秒内，即可利用主题生成静态网页。">

<link rel="canonical" href="http://chengg.top/2017/02/25/Hexo多平台部署page/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>Hexo多平台部署page | CHENG's NOTES</title>
  








  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">CHENG's NOTES</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
  </div>

  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-music">

    <a href="/music/" rel="section"><i class="fa fa-fw fa-music"></i>歌单</a>

  </li>
        <li class="menu-item menu-item-movies">

    <a href="/movies" rel="section"><i class="fa fa-fw fa-video-camera"></i>影视</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
  </ul>

</nav>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://chengg.top/2017/02/25/Hexo多平台部署page/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="https://tvax4.sinaimg.cn/crop.0.0.480.480.180/006ARivqly8fuwtj1v9edj30dc0dct9q.jpg">
      <meta itemprop="name" content="一叶不知秋丶">
      <meta itemprop="description" content="有人天生为王，有人落草为寇。">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="CHENG's NOTES">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Hexo多平台部署page
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2017-02-25 15:21:39" itemprop="dateCreated datePublished" datetime="2017-02-25T15:21:39+08:00">2017-02-25</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/学习笔记/" itemprop="url" rel="index">
                    <span itemprop="name">学习笔记</span>
                  </a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>Hexo是一个基于node.js的快速、简洁且高效的博客框架。Hexo使用Markdown或其他渲染引擎解析文章，在几秒内，即可利用主题生成静态网页。<br><a id="more"></a> </p>
<h3 id="hexo安装"><a href="#hexo安装" class="headerlink" title="hexo安装"></a>hexo安装</h3><p>软件准备：<a href="https://nodejs.org/en/" target="_blank" rel="noopener">node.js</a>、<a href="https://git-scm.com/downloads/" target="_blank" rel="noopener">git</a><br>搭建步骤：<br>1.成功安装Node.js<br>2.hexo安装及站点文件生成（右键git bash）： </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">1.install Hexo with npm：</span><br><span class="line">npm install hexo-cli -g 全局安装Hexo</span><br><span class="line">2.init Hexo：</span><br><span class="line">hexo init blogdemo  初始化hexo、在打开git bash的目录自动创建名为blogdemo的文件夹，此为站点源文件</span><br><span class="line">3.install dependency packages:</span><br><span class="line">npm install 安装相应的node modules，否则无法使用Hexo Commands</span><br><span class="line">4.generate pages：</span><br><span class="line">hexo g 生成一套静态网页</span><br><span class="line">5.run in localhost：</span><br><span class="line">hexo s 执行成功，在本地可通过localhost:4000进行访问</span><br><span class="line">6.deploy pages：</span><br><span class="line">hexo d 发布网页到支持pages服务的代码托管平台（eg：github、coding）</span><br></pre></td></tr></table></figure>
<p>以上过程若有疑问，移步<a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>官网。<br>注：deploy成功的前提是<br>在github、coding创建项目；更改站点根目录（上文提到的blogdemo）下_config.yml文件，找到deploy这一项，修改如下：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  repo:</span><br><span class="line">      github: git@github.com:blog/libra.github.io.git</span><br><span class="line">      coding: git@git.coding.net:blog/libra.git</span><br><span class="line">以上设置，可同时发布到github、coding。建议用ssh方式以免每次deploy输入git账号密码。</span><br><span class="line">ssh-keygen -t rsa -C &quot;youremail&quot; 生成ssh公私钥；</span><br><span class="line">到coding、github添加ssh key（复制本地C:\Users\username\.ssh文件下的id_rsa.pub内容）；</span><br><span class="line">测试连接ssh -T &quot;git@github.com&quot;。</span><br><span class="line">ssh -T git@github.com  </span><br><span class="line">当输出Hi xxx ! You&apos;ve successfully authenticated,即成功连接。</span><br></pre></td></tr></table></figure></p>
<p>关于Hexo主题，可移步<a href="http://www.zhihu.com/question/24422335" target="_blank" rel="noopener">知乎</a>、<a href="https://hexo.io/themes/" target="_blank" rel="noopener">Hexo themes</a>等网站。</p>
<h3 id="Hexo站点文件备份"><a href="#Hexo站点文件备份" class="headerlink" title="Hexo站点文件备份"></a>Hexo站点文件备份</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">git init（若主题是通过git clone方式获取，须先删除主题目录下的.git文件，否则主题文件不会上传）</span><br><span class="line">git add .</span><br><span class="line">git commit -m &quot;init hexo&quot;</span><br><span class="line">git remote add origin https://git.oschina.net/libracas/hexo_backup.git</span><br><span class="line">git push -u origin master</span><br><span class="line">以上操作将站点文件备份至代码托管平台进行维护。</span><br></pre></td></tr></table></figure>
<h3 id="绑定coding域名"><a href="#绑定coding域名" class="headerlink" title="绑定coding域名"></a>绑定coding域名</h3><p><a href="https://coding.net/help/doc/pages/index.html" target="_blank" rel="noopener">https://coding.net/help/doc/pages/index.html</a></p>




    
    
    

      <footer class="post-footer">
             <div> 
    <div style="text-align:center;color: #ccc;font-size:14px;"> 
    ------------- 本文结束 感谢您的阅读 ------------- 
    </div> 
    </div>
    </div>
          <div class="post-tags">
              <a href="/tags/hexo/" rel="tag"># hexo</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
                <a href="/2017/03/01/分布式文件系统FastDfs安装配置/" rel="prev" title="分布式文件系统FastDFS安装配置">
                  分布式文件系统FastDFS安装配置 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#hexo安装"><span class="nav-number">1.</span> <span class="nav-text">hexo安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Hexo站点文件备份"><span class="nav-number">2.</span> <span class="nav-text">Hexo站点文件备份</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#绑定coding域名"><span class="nav-number">3.</span> <span class="nav-text">绑定coding域名</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <img class="site-author-image" itemprop="image" alt="一叶不知秋丶"
    src="https://tvax4.sinaimg.cn/crop.0.0.480.480.180/006ARivqly8fuwtj1v9edj30dc0dct9q.jpg">
  <p class="site-author-name" itemprop="name">一叶不知秋丶</p>
  <div class="site-description" itemprop="description">有人天生为王，有人落草为寇。</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">5</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">2</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">4</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2019 </span>
 
  <span class="author" itemprop="copyrightHolder">Hosted by Gitee/Coding Pages 一叶不知秋丶</span>
</div>

        












        
      </div>
    </footer>
  </div>

  
  <script src="/lib/jquery/index.js?v=2.1.3"></script>
  <script src="/lib/anime.min.js?v=3.1.0"></script>
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script src="/js/utils.js?v=7.4.2"></script><script src="/js/motion.js?v=7.4.2"></script>
<script src="/js/schemes/pisces.js?v=7.4.2"></script>
<script src="/js/next-boot.js?v=7.4.2"></script>

  <script defer src="/lib/three/three.min.js"></script>
    <script defer src="/lib/three/canvas_lines.min.js"></script>


  


















  

  

  

</body>
</html>
